<template>
	<view class="content">
		<view class="item-box" >
			<view class="item" v-for="(item,i) in oldJson" @click="checkXiugai(i)">
				<view class="title">
					{{ item.text }}
				</view>
				
				<view class="path">
					{{ item.path }}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onShow
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue'

	const oldJson = ref([])
	
	const checkXiugai = (index) => {
		uni.navigateTo({
			url:`/pages/setting/setting-list/reg-path-view?id=${index}`
		})
	}

	onShow(() => {
		uni.getStorage({
			key: "data",
			success(res) {
				oldJson.value = JSON.parse(res.data)
				
				if (!res.data[0]) {
					oldJson.value = []
				}
			},
			fail(err) {
				oldJson.value = []
			}
		})
	})
</script>

<style lang="scss" scoped>
.content {
	padding: 10rpx;
	min-height: calc(100vh - 20rpx);
	.item-box {
		.item {
			margin-bottom: 10rpx;
			padding: 10rpx;
			background-color: #c8e3e3;
			border-radius: 6rpx;
			
			.title {
				overflow: hidden;
				white-space: nowrap;
				text-overflow: ellipsis;
			}
			
			.path {
				font-size: 12px;
				display: inline-block;
				max-width: 100%;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
			}
		}
	}
}
</style>